using System.Collections.Generic;
using System.Linq;

namespace System.Runtime.Remoting.ViewService
{
    [Serializable]
    class ActionsPool : MarshalByRefObject, IActionsPool
    {
        private static readonly List<IRemoteAction> sf_Actions = new List<IRemoteAction>();

        public static void Add(IRemoteAction Action) { sf_Actions.Add(Action); }

        public int Count { get { return sf_Actions.Count; } }
        public IRemoteAction this[int i] { get { return sf_Actions[i]; } }

        public IEnumerable<IRemoteAction> this[string Name] { get { return sf_Actions.Where(a => a.Name == Name); } }
    }

    [Serializable]
    class PropertiesPool : MarshalByRefObject, IPropertiesPool
    {
        private static readonly List<IRemoteProperty> sf_Properties = new List<IRemoteProperty>();

        public static void Add(IRemoteProperty Action) { sf_Properties.Add(Action); }

        public int Count { get { return sf_Properties.Count; } }
        public IRemoteProperty this[int i] { get { return sf_Properties[i]; } }

        public IEnumerable<IRemoteProperty> this[string Name] { get { return sf_Properties.Where(a => a.Name == Name); } }
    }

    [Serializable]
    class EventsPool : MarshalByRefObject, IEventsPool
    {
        private static readonly List<IRemoteEvent> sf_Properties = new List<IRemoteEvent>();

        public static void Add(IRemoteEvent Event) { sf_Properties.Add(Event); }

        public int Count { get { return sf_Properties.Count; } }
        public IRemoteEvent this[int i] { get { return sf_Properties[i]; } }

        public IEnumerable<IRemoteEvent> this[string Name] { get { return sf_Properties.Where(a => a.Name == Name); } }
    }
}